/*
* Copyright (C) 2020 ~ 2024 chaigec All Rights Reserved.
*
* Author:     chaigec <chaigec@163.com>
* Maintainer: chaigec <chaigec@163.com>

 * Use of this source code is governed by MIT license that can be found in the
 * LICENSE file in the root of the source tree. All contributing project authors
 * may be found in the AUTHORS file in the root of the source tree.
*/

#ifndef MK_PTZ_COMMAND_H
#define MK_PTZ_COMMAND_H
#include "MkTypes.h"

typedef enum _ptz_command
{
    //移动.
    MkPtzStop = 0,
    MkPtzUp,
    MkPtzDown,
    MkPtzLeft,
    MkPtzRight,

    MkPtzLeftUp,
    MkPtzRightUp,
    MkPtzLeftDown,
    MkPtzRightDown,
    MkPtzHorseCtorAutoScan, //水平扫描
    MkPtzVerseCtorAutoScan, //垂直扫描

    MkPtzZoomIn,			//焦距
    MkPtzZoomOut,
    MkPtzFocusNear,		//聚焦
    MkPtzFocusFar,
    MkPtzApertureOpen,	//光圈
    MkPtzApertureClose,

    //功能设备
    MkPtzLightTurnOn,    //开灯光
    MkPtzLightTurnOff,   //关灯
    MkPtzWiperTurnOn,    //开雨刷
    MkPtzWiperTurnOff,   //关雨刷
    MkPtzFanTurnOn,       //开风扇
    MkPtzFanTurnOff,      //关风扇
    MkPtzHeaterTurnOn,    //开加热器
    MkPtzHeaterTurnOff,   //关加热器
    MkPtzAuxTurnOn,       //打开辅组开关
    MkPtzAuxTurnOff,     //关闭辅组开关

    //预置位
    MkPtzGotoPreset,
    MkPtzSetPreset,
    MkPtzDelPreset,

    //cruise 巡航 
    MkPtzCruiseFillPre,	//将预置点加入巡航序列
    MkPtzCruiseSetDwell,	//设置巡航点停顿时间
    MkPtzCruiseSetSpeed,	//设置巡航速度
    MkPtzCruiseClearPre,	//将预置位从巡航删除
    MkPtzCruiseRun,	//云台开启巡航
    MkPtzCruiseClear, //删除巡航
    MkPtz3DZoom, 	//3D云台控制
    MkPtzPrecisePosition
}MkPtzCommand;


typedef enum _state_grid_ptz_command_type
{
    MkStateGridPtz3DZoom = 0x0001,
    MkStateGridPtzApertuerCloseStop = 0x0101,
    MkStateGridPtzApertuerClose = 0x0102,
    MkStateGridPtzApertuerOpen = 0x0103,
    MkStateGridPtzApertuerOpenStop = 0x0104,
    MkStateGridPtzFocusNearStop = 0x0201,
    MkStateGridPtzFocusNear = 0x0202,
    MkStateGridPtzFocusFarStop = 0x0203,
    MkStateGridPtzFocusFar = 0x0204,
    MkStateGridPtzZoomInStop = 0x0301,
    MkStateGridPtzZoomIn = 0x0302,
    MkStateGridPtzZoomOutStop = 0x0303,
    MkStateGridPtzZoomOut = 0x0304,
    MkStateGridPtzUpStop = 0x0401,
    MkStateGridPtzUp = 0x0402,
    MkStateGridPtzDownStop = 0x0403,
    MkStateGridPtzDown = 0x0404,
    MkStateGridPtzRightStop = 0x0501,
    MkStateGridPtzRight = 0x0502,
    MkStateGridPtzLeftStop = 0x0503,
    MkStateGridPtzLeft = 0x0504,
    MkStateGridPtzSetPreset = 0x0601,
    MkStateGridPtzCallPreset = 0x0602,
    MkStateGridPtzDelPreset = 0x0603,
    MkStateGridPtzLeftUpStop = 0x0701,
    MkStateGridPtzLeftUp = 0x0702,
    MkStateGridPtzLeftDownStop = 0x0703,
    MkStateGridPtzLeftDown = 0x0704,
    MkStateGridPtzRightUpStop = 0x0801,
    MkStateGridPtzRightUp = 0x0802,
    MkStateGridPtzRightDownStop = 0x0803,
    MkStateGridPtzRightDown = 0x0804,
    MkStateGridPtzStop = 0x0901,
    MkStateGridPtzWiperOn = 0x0a01,
    MkStateGridPtzWiperOff = 0x0a02,
    MkStateGridPtzLightOn = 0x0b01,
    MkStateGridPtzLightOff = 0x0b02,
    MkStateGridPtzWarmOn = 0x0c01,
    MkStateGridPtzWarmOff = 0x0c02,
    MkStateGridPtzInfraredOn = 0x0d01,
    MkStateGridPtzInfraredOff = 0x0d02,
    MkStateGridPtzLinearSweep = 0x0e01,
    MkStateGridPtzLinearSweepStop = 0x0e02,
    MkStateGridPtzTrajectoryCruise = 0x0f01,
    MkStateGridPtzTrajectoryCruiseStop = 0x0f02,
    MkStateGridPtzPresetCruise = 0x1001,
    MkStateGridPtzPresetCruiseOff = 0x1002,
    MkStateGridPtzLock = 0x1101,
    MkStateGridPtzUnLock = 0x1102,
    MkStateGridPtzSetDefaultPreset = 0x1201
}MkStateGridPtzCommandType;

class CMkPtzCommand
{
public:
    ~CMkPtzCommand();
    static CMkPtzCommand& GetIntance() { return m_Instance; }
    Uint32 GetPtzCommand(const MkString& PtzCmd, MkPtzCommand& Cmd) const;
    Uint32 GetStrPtzCommand(const MkPtzCommand& MkCmd, MkString& strPtzCmd) const;
    const MkUnorderedMap<MkString, MkPtzCommand>& GetMapPtzCommand() { return m_MapPtzCommand; }

    static Uint32 SystemPtzControlToStateGridPtz(const MkPtzCommand& MkCmd,MkStateGridPtzCommandType& SgType);
    static Uint32 StateGridPtzControlToSystem(const MkStateGridPtzCommandType& SgType, MkPtzCommand& MkCmd);
private:
    CMkPtzCommand();
private:
    static CMkPtzCommand                        m_Instance;
    MkUnorderedMap<MkString, MkPtzCommand>      m_MapPtzCommand;
};


#endif